﻿using System.Data;
using Think9.CreatCode;
using Think9.Services.Base;

namespace Think9.Services.Basic
{
    public class AppSet
    {
        public static TableDtModel GetTableDtModel(string maintbid)
        {
            TableDtModel model = new TableDtModel();
            ComService comService = new ComService();

            string sql = "select * from TbTag order by TbId,OrderNo";
            DataTable dtTbTag = comService.GetDataTable(sql);
            model.dtTbTag = dtTbTag;

            sql = "select * from TbButCustomize order by TbId,GridId";
            DataTable dtTbButCustomize = comService.GetDataTable(sql);
            model.dtTbButCustomize = dtTbButCustomize;

            sql = "select * from TbButCustomizeEvent order by BtnId,OrderNo";
            DataTable dtTbButCustomizeEvent = comService.GetDataTable(sql);
            model.dtTbButCustomizeEvent = dtTbButCustomizeEvent;

            sql = "select * from TbEventCustomize order by TbId,OrderNo";
            DataTable dtTbEventCustomize = comService.GetDataTable(sql);
            model.dtTbEventCustomize = dtTbEventCustomize;

            sql = "select * from TbEventPara order by TbId,Id";
            DataTable dtTbEventPara = comService.GetDataTable(sql);
            model.dtTbEventPara = dtTbEventPara;

            sql = "select * from TbIndex order by TbId,IndexOrderNo";
            DataTable _dtindex = comService.GetDataTable(sql);
            model.dtIndex = _dtindex;

            sql = "select * from tbbasic where ParentId='" + maintbid + "'";
            DataTable sonlist = comService.GetDataTable(sql);
            model.sonList = sonlist;

            sql = "select * from tbbasic ";
            DataTable allTB = comService.GetDataTable(sql);
            model.allTB = allTB;

            sql = "select * from tbbasic2 ";
            DataTable allTB2 = comService.GetDataTable(sql);
            model.allTB2 = allTB2;

            sql = "select * from rulesingle";
            DataTable dtrulesingle = comService.GetDataTable(sql);
            model.dtRuleSingle = dtrulesingle;

            sql = "select * from RuleMultiple";
            DataTable dtrulemultiple = comService.GetDataTable(sql);
            model.dtRuleMultiple = dtrulemultiple;

            sql = "select * from RuleMultiplefiled order by RuleId,FiledOrder";
            DataTable dtrulemultiplefiled = comService.GetDataTable(sql);
            model.dtRuleMultipleFiled = dtrulemultiplefiled;

            sql = "select * from ruletree";
            DataTable dtruletree = comService.GetDataTable(sql);
            model.dtRuleTree = dtruletree;

            sql = "select * from flow";
            DataTable dtflow = comService.GetDataTable(sql);
            model.dtFlow = dtflow;

            sql = "select * from flowprcs order by FlowId,PrcsNo";
            DataTable dtflowprcs = comService.GetDataTable(sql);
            model.dtFlowPrcs = dtflowprcs;

            sql = "select * from tbbut order by TbId";
            DataTable dtTbBut = comService.GetDataTable(sql);
            model.dtTbBut = dtTbBut;

            sql = "SELECT TbRelation.*,RelationList.* FROM  TbRelation INNER JOIN RelationList ON TbRelation.RelationId = RelationList.RelationId  ";
            DataTable dtVIEW_TbRelationRD = comService.GetDataTable(sql);
            model.dtVIEW_TbRelationRD = dtVIEW_TbRelationRD;

            sql = "select * from RelationRD order by RelationId";
            DataTable dtRelationRD = comService.GetDataTable(sql);
            model.dtRelationRD = dtRelationRD;

            sql = "select * from RelationRDField order by ID, FillIndexId";//order by ID很重要--对数据联动
            DataTable dtRelationRDField = comService.GetDataTable(sql);
            model.dtRelationRDField = dtRelationRDField;

            sql = @"SELECT RelationList.RelationId, RelationList.RelationType, RelationList.RelationName, RelationList.RelationBy, RelationList.RelationFlag, RelationList.FlowStr, RelationList.ICount,  RelationWD.SourceFlowId, RelationWD.SourceTbId, RelationWD.FlowPrcs, RelationWD.WriteTbId,RelationWD.RelationWDFlag, RelationWD.OrderNo, RelationWD.RelationWDBy, TbRelation.TbID,TbRelation.FlowScope, RelationWD.WhereStr, RelationWD.NumberType, RelationWD.RelationSort,RelationList.DbID FROM  RelationList INNER JOIN RelationWD ON RelationList.RelationId = RelationWD.RelationId INNER JOIN TbRelation ON RelationList.RelationId = TbRelation.RelationId  where TbRelation.isUse='1' order by RelationId";

            DataTable dtVIEW_TbRelationWD = comService.GetDataTable(sql);
            model.dtVIEW_TbRelationWD = dtVIEW_TbRelationWD;

            sql = @"select * from RelationWDField";
            DataTable dtRelationWDField = comService.GetDataTable(sql);
            model.dtRelationWDField = dtRelationWDField;

            sql = @"select * from externaldb";
            DataTable dtExternalDb = comService.GetDataTable(sql);
            model.dtExternalDb = dtExternalDb;

            return model;
        }

        public static TableDtModel GetTableDtModel()
        {
            TableDtModel model = new TableDtModel();

            ComService comService = new ComService();

            string sql = "select * from TbTag order by TbId,OrderNo";
            DataTable dtTbTag = comService.GetDataTable(sql);
            model.dtTbTag = dtTbTag;

            sql = "select * from TbButCustomize order by TbId,GridId";
            DataTable dtTbButCustomize = comService.GetDataTable(sql);
            model.dtTbButCustomize = dtTbButCustomize;

            sql = "select * from TbButCustomizeEvent order by BtnId,OrderNo";
            DataTable dtTbButCustomizeEvent = comService.GetDataTable(sql);
            model.dtTbButCustomizeEvent = dtTbButCustomizeEvent;

            sql = "select * from TbEventCustomize order by TbId,OrderNo";
            DataTable dtTbEventCustomize = comService.GetDataTable(sql);
            model.dtTbEventCustomize = dtTbEventCustomize;

            sql = "select * from TbEventPara order by TbId,Id";
            DataTable dtTbEventPara = comService.GetDataTable(sql);
            model.dtTbEventPara = dtTbEventPara;

            sql = "select * from TbIndex order by TbId,IndexOrderNo";
            DataTable _dtindex = comService.GetDataTable(sql);
            model.dtIndex = _dtindex;

            sql = "select * from RuleList";
            model.dtRuleList = comService.GetDataTable(sql);

            sql = "select * from tbbasic ";
            DataTable allTB = comService.GetDataTable(sql);
            model.allTB = allTB;

            sql = "select * from tbbasic2 ";
            DataTable allTB2 = comService.GetDataTable(sql);
            model.allTB2 = allTB2;

            sql = "select * from rulesingle";
            DataTable dtrulesingle = comService.GetDataTable(sql);
            model.dtRuleSingle = dtrulesingle;

            sql = "select * from RuleMultiple";
            DataTable dtrulemultiple = comService.GetDataTable(sql);
            model.dtRuleMultiple = dtrulemultiple;

            sql = "select * from RuleMultiplefiled order by RuleId,FiledOrder";
            DataTable dtrulemultiplefiled = comService.GetDataTable(sql);
            model.dtRuleMultipleFiled = dtrulemultiplefiled;

            sql = "select * from ruletree";
            DataTable dtruletree = comService.GetDataTable(sql);
            model.dtRuleTree = dtruletree;

            sql = "select * from flow";
            DataTable dtflow = comService.GetDataTable(sql);
            model.dtFlow = dtflow;

            sql = "select * from flowprcs order by FlowId,PrcsNo";
            DataTable dtflowprcs = comService.GetDataTable(sql);
            model.dtFlowPrcs = dtflowprcs;

            sql = "select * from tbbut order by TbId";
            DataTable dtTbBut = comService.GetDataTable(sql);
            model.dtTbBut = dtTbBut;

            sql = "SELECT TbRelation.*,RelationList.* FROM  TbRelation INNER JOIN RelationList ON TbRelation.RelationId = RelationList.RelationId  ";
            DataTable dtVIEW_TbRelationRD = comService.GetDataTable(sql);
            model.dtVIEW_TbRelationRD = dtVIEW_TbRelationRD;

            sql = "select * from RelationRD order by RelationId";
            DataTable dtRelationRD = comService.GetDataTable(sql);
            model.dtRelationRD = dtRelationRD;

            sql = "select * from RelationRDField order by ID, FillIndexId";//order by ID很重要--对数据联动
            DataTable dtRelationRDField = comService.GetDataTable(sql);
            model.dtRelationRDField = dtRelationRDField;

            sql = @"SELECT RelationList.RelationId, RelationList.RelationType, RelationList.RelationName, RelationList.RelationBy, RelationList.RelationFlag, RelationList.FlowStr, RelationList.ICount,  RelationWD.SourceFlowId, RelationWD.SourceTbId, RelationWD.FlowPrcs, RelationWD.WriteTbId,RelationWD.RelationWDFlag, RelationWD.OrderNo, RelationWD.RelationWDBy, TbRelation.TbID,TbRelation.FlowScope, RelationWD.WhereStr, RelationWD.NumberType, RelationWD.RelationSort,RelationList.DbID FROM  RelationList INNER JOIN RelationWD ON RelationList.RelationId = RelationWD.RelationId INNER JOIN TbRelation ON RelationList.RelationId = TbRelation.RelationId  where TbRelation.isUse='1' order by RelationId";
            DataTable dtVIEW_TbRelationWD = comService.GetDataTable(sql);
            model.dtVIEW_TbRelationWD = dtVIEW_TbRelationWD;

            sql = @"select * from RelationWDField";
            DataTable dtRelationWDField = comService.GetDataTable(sql);
            model.dtRelationWDField = dtRelationWDField;

            sql = @"select * from externaldb";
            DataTable dtExternalDb = comService.GetDataTable(sql);
            model.dtExternalDb = dtExternalDb;

            return model;
        }

        public static ReportDtModel GetReportDtModel(string _dbtype)
        {
            string order = "";
            string sql = "select * from TbIndex order by TbId,IndexOrderNo";
            ComService comService = new ComService();

            ReportDtModel model = new ReportDtModel();

            sql = "select * from TbIndex order by TbId,IndexOrderNo";
            DataTable _dtindex = comService.GetDataTable(sql);
            model.dtIndex = _dtindex;

            sql = "select * from tbbasic ";
            DataTable allTB = comService.GetDataTable(sql);
            model.allTB = allTB;

            sql = "select * from RuleList";
            model.dtRuleList = comService.GetDataTable(sql);

            sql = "select * from rulesingle";
            DataTable dtrulesingle = comService.GetDataTable(sql);
            model.dtRuleSingle = dtrulesingle;

            sql = "select * from RuleMultiple";
            DataTable dtrulemultiple = comService.GetDataTable(sql);
            model.dtRuleMultiple = dtrulemultiple;

            sql = "select * from RuleMultiplefiled order by RuleId,FiledOrder";
            DataTable dtrulemultiplefiled = comService.GetDataTable(sql);
            model.dtRuleMultipleFiled = dtrulemultiplefiled;

            sql = "select * from ruletree";
            DataTable dtruletree = comService.GetDataTable(sql);
            model.dtRuleTree = dtruletree;

            order = "ORDER BY LENGTH(ParmId) DESC";
            if (_dbtype != "mysql")
            {
                order = "ORDER BY LEN(ParmId) DESC";
            }
            sql = "select * from IndexParm ";
            model.IndexParm = comService.GetDataTable(sql + order);

            sql = "select * from ReportParm  ";
            model.ReportParm = comService.GetDataTable(sql);

            order = "ORDER BY LENGTH(IndexId) DESC";
            if (_dbtype != "mysql")
            {
                order = "ORDER BY LEN(IndexId) DESC";
            }
            sql = "select * from IndexStats ";
            model.IndexStats = comService.GetDataTable(sql + order);

            sql = "select * from ReportBasic ";
            model.ReportBasic = comService.GetDataTable(sql);

            sql = "select * from ReportCols  order by ReportId,ColNum ";
            model.ReportCols = comService.GetDataTable(sql);

            sql = "select * from ReportRows order by ReportId,OrderNo ";
            model.ReportRows = comService.GetDataTable(sql);

            sql = "select * from ReportDYNParm";
            model.ReportDYNParm = comService.GetDataTable(sql);

            sql = "select * from ReportParmQuery order by ReportId,OrderNo ";
            model.ReportParmQuery = comService.GetDataTable(sql);

            sql = "select * from ReportParmQuerySelect";
            model.ReportParmQuerySelect = comService.GetDataTable(sql);

            sql = @"SELECT ReportParm.ReportId, ReportParm.ColNum,ReportParm.RowId,ReportParm.ParmId, ReportParm.ParmValue,ReportRows.Type,ReportRows.OrderNo, ReportRows.DynamicId,ReportRows.I1, ReportRows.I2, ReportRows.I3, ReportRows.I4, ReportRows.I5, ReportRows.I6,ReportRows.I7, ReportRows.I8, ReportRows.I9, ReportRows.I10, ReportRows.I11,ReportRows.I12, ReportRows.I13, ReportRows.I14, ReportRows.I15, ReportRows.I16,ReportRows.I17, ReportRows.I18, ReportRows.I19, ReportRows.I20, ReportRows.I21,ReportRows.I22, ReportRows.I23, ReportRows.I24, ReportRows.I25, ReportRows.I26,ReportRows.I27, ReportRows.I28, ReportRows.I29, ReportRows.I30, ReportRows.I31,ReportRows.I32, ReportRows.I33, ReportRows.I34, ReportRows.I35, ReportRows.I36,ReportRows.I37, ReportRows.I38, ReportRows.I39, ReportRows.I40, ReportRows.I41,ReportRows.I42, ReportRows.I43, ReportRows.I44, ReportRows.I45, ReportRows.I46,ReportRows.I47, ReportRows.I48, ReportRows.I49, ReportRows.I50  FROM ReportRows INNER JOIN ReportParm ON ReportRows.id = ReportParm.RowId order by ReportRows.ReportId,ReportRows.OrderNo ";
            model.ReportParm_View = comService.GetDataTable(sql);

            sql = "select * from ReportIndexCol  order by ReportId,OrderNo";
            model.ReportIndexCol = comService.GetDataTable(sql);

            sql = "select * from ReportIndexColParm";
            model.ReportIndexColParm = comService.GetDataTable(sql);

            sql = "select * from ReportIndexSearch order by ReportId,OrderNo";
            model.ReportIndexSearch = comService.GetDataTable(sql);

            sql = "select * from ReportIndexOrder order by ReportId,OrderNo";
            model.ReportIndexOrder = comService.GetDataTable(sql);

            model.allView = comService.GetViewsList();

            DataTable dt = DataTableHelp.NewViewFieldDt();
            foreach (DataRow drView in model.allView.Rows)
            {
                foreach (DataRow dr in comService.GetTbFieldsList(drView["Name"].ToString()).Rows)
                {
                    DataRow row = dt.NewRow();
                    row["View_Name"] = drView["Name"].ToString();
                    row["COLUMN_NAME"] = dr["COLUMN_NAME"].ToString();
                    row["DATA_type"] = dr["DATA_type"].ToString();
                    dt.Rows.Add(row);
                }
            }
            model.ViewField = dt;

            sql = @"select * from externaldb";
            DataTable dtExternalDb = comService.GetDataTable(sql);
            model.dtExternalDb = dtExternalDb;

            string dbId = "";
            string dbType = "";
            string dbName = "";
            string dbCon = "";
            string tbid = "";
            ExtraDbService extraDb = new ExtraDbService();
            DataTable dtExtraDbTbFields = DataTableHelp.NewTableFieldDt();
            foreach (DataRow drDb in dtExternalDb.Rows)
            {
                dbId = drDb["DbID"].ToString();
                dbType = drDb["DbType"].ToString();
                dbName = drDb["DbName"].ToString();
                dbCon = drDb["DbCon"].ToString();

                if (comService.GetTotal("reportbasic", "where DbID=" + dbId + "") > 0)
                {
                    //取视图和数据表
                    DataTable dbTableAndView = extraDb.GetTableAndViewList(dbCon, dbType, dbName);//
                    foreach (DataRow drTable in dbTableAndView.Rows)
                    {
                        tbid = drTable["table_name"].ToString();
                        if (comService.GetTotal("reportbasic", "where DbID=" + dbId + " and TbId='" + tbid + "' ") > 0)
                        {
                            DataTable tbTbFieldList = extraDb.GetTbFieldsList(dbCon, dbType, dbName, tbid);//
                            foreach (DataRow drField in tbTbFieldList.Rows)
                            {
                                DataRow row = dtExtraDbTbFields.NewRow();
                                row["DbId"] = dbId;
                                row["DbType"] = dbType;
                                row["Table_Name"] = tbid;
                                row["COLUMN_NAME"] = drField["COLUMN_NAME"].ToString();
                                row["DATA_type"] = drField["DATA_type"].ToString();
                                dtExtraDbTbFields.Rows.Add(row);
                            }
                        }
                    }
                }
            }
            model.dtExtraDbTbFields = dtExtraDbTbFields;

            return model;
        }

        public static AppSetEntity GetSetModel(string siteRoot, string dbType, string directoryType = "1")
        {
            string templetFilePath = "";

            AppSetEntity model = new AppSetEntity();

            model.CopyCodeStr = Think9.Services.Base.Configs.GetValue("CopyCodeStr");
            model.URL = Think9.Services.Base.Configs.GetValue("YoursLCSA");
            model.AppId = Think9.Services.Base.Configs.GetValue("YoursLCAppId");
            model.PassWord = Think9.Services.Base.Configs.GetValue("YoursLCPassWord");

            model.DbType = dbType;
            model.DirectoryType = directoryType;//目录类别--下载代码时才起作用 1表示Controllers、Services作为根目录 2表示以录入表编码作为根目录

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\BuildCode.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.BuildCode = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ControllerCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ControllerCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ControllerGridCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ControllerGridCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ServiceGridCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ServiceGridCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ControllerPUCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ControllerPUCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\GridServiceCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.GridServiceCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ServiceCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ServiceCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            //Layui
            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\DetailCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.DetailCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\MobileDetailCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.MobileDetailCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\FormCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.FormCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\MobileFormCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.MobileFormCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\GridColumnCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.GridColumnCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\FormGrid2Cshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.FormGrid2Cshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\FormGridCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.FormGridCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\MobileFormGridCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.MobileFormGridCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\FormNoGridCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.FormNoGridCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\ListCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ListCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\MobileListCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.MobileListCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\PuCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.PuCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\PuCshtmlDict.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.PuCshtmlDict = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\PuCshtmlTree.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.PuCshtmlTree = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\SelfJS.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.SelfJS = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Rdlc\\TableRdlc.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.TableRdlc = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Rdlc\\ListRdlc.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ListRdlc = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Rdlc\\ReportRdlc.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportRdlc = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Rdlc\\ReportRdlc2.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportRdlc2 = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ReportControllerCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportControllerCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ReportServiceCs.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportServiceCs = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\ReportCshtml.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportCshtml = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ReportControllerCs2.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportControllerCs2 = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Dapper\\ReportServiceCs2.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportServiceCs2 = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            templetFilePath = siteRoot + "\\wwwroot\\AppTempletFile\\Layui\\ReportCshtml2.txt";
            if (System.IO.File.Exists(templetFilePath))
            {
                model.ReportCshtml2 = Think9.Util.Helper.FileHelper.FileToString(templetFilePath);
            }

            return model;
        }
    }
}